<template>
  <div>
    <detail-banner :bannerImg="bannerImg" :title="bannerTitle" :gallaryList="gallaryList"></detail-banner>
    <detail-header></detail-header>
    <div class="content">
      <detail-list :list="categoryList"></detail-list>
    </div>
    <detail-discuss :discuss="discuss"></detail-discuss>
  </div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
import DetailDiscuss from './components/Discuss'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailBanner: DetailBanner,
    DetailHeader: DetailHeader,
    DetailList: DetailList,
    DetailDiscuss: DetailDiscuss
  },
  data () {
    return {
      bannerImg: '',
      bannerTitle: '',
      gallaryList: [],
      categoryList: [],
      discuss: []
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.getDetailInfoSuccess)
    },
    getDetailInfoSuccess (res) {
      res = res.data
      if (res.ret && res.data) {
        this.categoryList = res.data.categoryList
        this.bannerImg = res.data.bannerImg
        this.bannerTitle = res.data.sightName
        this.gallaryList = res.data.gallaryImgs
        this.discuss = res.data.discuss
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped>

</style>
